//封装与管理员相关的请求

import { request } from "@/utils/request";

//1、提交课程表设置信息
export function setScheduleAPI(dataForm){
    return request({
        url:'/admin/course/schedule',
        method:'POST',
        data:dataForm
    })
}

//2、获取课程表
export function getScheduleAPI(user_id){
    if(user_id ==='')
    return request({
        url:'/admin/course/schedule/show',
        method:'GET'
    })
    else
    return request({
        url:`/course/schedule/show/${user_id}`,
        method:'GET'
    })
}

//3、获取调课信息
export function getAppliAPI(){
    return request({
        url:'/admin/course/application',
        method:'GET'
    })
}

//4、更新审核状态
export function updateAppliAPI(studentId,aState){
    return request({
        url: '/admin/course/application',
        method: 'PUT',
        data:{
            appState:aState,
            studentId:studentId
        }
    })
}

//初始化学员、教练信息
export function setUserInfoAPI(dataForm){
    return request({
        url:'/admin/initialize',
        method:'POST',
        data:dataForm
    })
}

//搜索学员、教练信息
export function searchUserInfoAPI(userId,type){
    return request({
        url:`/admin/search/${userId}`,
        method:'GET'
    })
}

//修改学员信息
// export function updateStudentInfoAPI(studentId,aState){
//     return request({
//         url: `/admin/user/${studentId}`,
//         method: 'PUT',
//         data:{
//             appState:aState
//         }
//     })
// }

//搜索用户信息
export function searchUserTypeAPI(userId){
    return request({
        url:`/admin/changeAuthority/search/${userId}`,
        method:'GET'
    })
}

//更改用户权限
export function updateUserTypeAPI(userId,data){
    return request({
        url:'/admin/changeAuthority/change',
        method:'POST',
        data:{
            userId:userId,
            identity:data
        }
    })
}

//获取学员学习进度
export function getStudentLearnProcessAPI(userId){
    return request({
        url:`/admin/getStudentLearnProcess/${userId}`,
        method:'GET'
    })
}

//设置车辆保修记录
export function setWarRecAPI(dataForm){
    return request({
        url:"/admin/carManage/setRec",
        method:'POST',
        data:dataForm
    })
}
//获取车辆保修记录
export function getWarRecAPI(){
    return request({
        url:"/admin/carManage/getRec",
        method:'GET'
    })
}
